<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<title>Welcome CRM</title>
<script src="js/jquery-1.9.1.js"></script>
<script type="text/javascript">
	$(function() {
		$('#login').unbind().bind('click', function() {
			var username = $("#username")[0].value;
			var password = $("#password")[0].value;
			if (username == "" || username == null) {
				alert("please input username");
				return false;
			} else if (password == "" || username == null) {
				alert("please input password");
				return false;
			}

			$.getJSON("admin/servlet?method=login", {
				'username' : username,
				'password' : password
			}, function(data) {
				if ('admin' == data) {
					self.location = 'admin/admin.jsp';
				} else if ('user' == data) {
					self.location = 'user/user.jsp';
				} else {
					alert(data);
				}
			});
		});
	});
</script>
</head>
<body>
<div style="width: 100%; height: 100%">
<div style="margin: auto; margin-left: 500px; margin-top: 160px;">
<span>欢迎使用CRM系统,不支持IE浏览器</span></div>
<div style="margin: auto; margin-left: 500px; margin-top: 40px;">
<table>
	<tr>
		<td>用户名:</td>
		<td><input type="text" id="username" /></td>
	</tr>
	<tr>
		<td>密&nbsp;&nbsp;码:</td>
		<td><input type="text" id="password" /></td>
	</tr>
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr style="margin-top: 20px;">
		<td colspan="2" align="center"><input type="submit" value="登录"
			id="login" style="width: 120px; height: 24px;" /></td>
	</tr>
</table>
</div>
</div>
</body>
</html>